/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.cspimp.psp.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import me.zhengjie.base.BaseCspImpEntity;
import me.zhengjie.base.BaseEntity;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://docs.auauz.net
* @description /
* @author zmm
* @date 2020-05-30
**/
@Entity
@Data
@Table(name="psp_chemicla")
public class Chemicla extends BaseCspImpEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "chemicals_cn",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "化学品中文名称")
    private String chemicalsCn;

    @Column(name = "chemicals_en")
    @ApiModelProperty(value = "化学品英文名称")
    private String chemicalsEn;

    @Column(name = "chemicals_alias")
    @ApiModelProperty(value = "化学品别名")
    private String chemicalsAlias;

    @Column(name = "chemicals_cas")
    @ApiModelProperty(value = "cas")
    private String chemicalsCas;

    @Column(name = "chemicals_type")
//    @NotBlank
    @ApiModelProperty(value = "化学品类别")
    private String chemicalsType;

    @Column(name = "chemicals_msds")
    @ApiModelProperty(value = "化学品文件")
    private String chemicalsMsds;

    @Column(name = "supplier_name")
//    @NotBlank
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;

    @Column(name = "supplier_contact_name")
//    @NotBlank
    @ApiModelProperty(value = "供应商联系人")
    private String supplierContactName;

    @Column(name = "supplier_contact_phone")
//    @NotBlank
    @ApiModelProperty(value = "供应商联系方式")
    private String supplierContactPhone;

    @Column(name = "em_consultant_name")
//    @NotBlank
    @ApiModelProperty(value = "咨询单位名称")
    private String emConsultantName;

    @Column(name = "em_contact_name")
//    @NotBlank
    @ApiModelProperty(value = "应急联系人")
    private String emContactName;

    @Column(name = "em_contact_phone")
//    @NotBlank
    @ApiModelProperty(value = "应急联系方式")
    private String emContactPhone;

    @Column(name = "storage_area")
//    @NotBlank
    @ApiModelProperty(value = "仓库区域")
    private Long storageArea;

    @Column(name = "use_area")
//    @NotBlank
    @ApiModelProperty(value = "使用区域")
    private Long useArea;

    @Column(name = "is_dangerous_good")
//    @NotNull
    @ApiModelProperty(value = "是否是危险品")
    private String isDangerousGood;

    @Column(name = "dangerous_category")
//    @NotBlank
    @ApiModelProperty(value = "危险类型")
    private String dangerousCategory;

    @Column(name = "registration_no")
//    @NotBlank
    @ApiModelProperty(value = "登记号")
    private String registrationNo;

    @Column(name = "packing_category")
//    @NotBlank
    @ApiModelProperty(value = "包装类别")
    private String packingCategory;

    @Column(name = "hazard_characteristics")
    @ApiModelProperty(value = "危险特性")
    private String hazardCharacteristics;

    @Column(name = "active_hazard")
    @ApiModelProperty(value = "活性危害")
    private String activeHazard;

    @Column(name = "prevention")
    @ApiModelProperty(value = "预防及应急措施")
    private String prevention;

    @Column(name = "hazard_no")
//    @NotBlank
    @ApiModelProperty(value = "危规号")
    private String hazardNo;

    @Column(name = "incompatibility")
    @ApiModelProperty(value = "禁配物")
    private String incompatibility;

    @Column(name = "stock_count")
    @ApiModelProperty(value = "库存量")
    private Integer stockCount;

    public void copy(Chemicla source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}